# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=nsec3map
pkgver=v0.8.2.r0.gd145b13
pkgrel=1
epoch=1
pkgdesc='A tool to enumerate the resource records of a DNS zone using its DNSSEC NSEC or NSEC3 chain.'
arch=('any')
groups=('blackarch' 'blackarch-recon' 'blackarch-scanner')
url='https://github.com/anonion0/nsec3map'
license=('GPL-3.0-only')
depends=('python' 'python-dnspython' 'python-numpy' 'python-scipy' 'openssl')
makedepends=('git' 'python-build' 'python-installer' 'python-setuptools'
             'python-wheel')
source=("git+https://github.com/anonion0/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  ( set -o pipefail
    git describe --long --tags --abbrev=7 2>/dev/null |
      sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "%s.%s" "$(git rev-list --count HEAD)" \
      "$(git rev-parse --short=7 HEAD)"
  )
}

build() {
  cd "$pkgname"

  python -m build --wheel --no-isolation
}

package() {
  cd "$pkgname"

  install -dm 755 "$pkgdir/usr/share/bash-completion/completions"
  install -Dm 644 n3map.bash_completion \
    "$pkgdir/usr/share/bash-completion/completions/n3map"

  python -m installer --destdir="$pkgdir" dist/*.whl
}

